package com.example.sample.control;

import android.content.Context;
import android.graphics.Point;
import android.util.AttributeSet;
import android.widget.VideoView;

import net.liteheaven.xblib.common.ui.DimensionUtil;

public class FixedVideoView extends VideoView {

	public FixedVideoView(Context context) {
		super(context);
	}

	public FixedVideoView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public FixedVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
	}
	
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		Context ctx = getContext();
		Point sc = DimensionUtil.getScreenSize(ctx);
		
		int xspec = MeasureSpec.makeMeasureSpec(sc.x, MeasureSpec.EXACTLY);
		int yspec = MeasureSpec.makeMeasureSpec(sc.y, MeasureSpec.EXACTLY);
		setMeasuredDimension(xspec,yspec);
	}

}
